using System;
using System.Windows.Forms;
using System.Drawing;
using TestMap;
using System.IO;

namespace DrawTools
{
	/// <summary>
	/// Rectangle tool
	/// </summary>
	public class ToolRectangle : DrawTools.ToolObject
	{
		public ToolRectangle()
		{
            Cursor = new Cursor("Rectangle.cur");
		}

        public override void OnMouseDown(Form1 drawArea, AxMapXLib.CMapXEvents_MouseDownEvent e)
        {
            Point p = new Point((int)e.x, (int)e.y);
            AddNewObject(drawArea, new DrawRectangle(p.X, p.Y, 1, 1));
        }

        public override void OnMouseMove(Form1 drawArea, AxMapXLib.CMapXEvents_MouseMoveEvent e)
        {
            drawArea.Cursor = Cursor;

            if (e.button == 1)
            {
                Point p = new Point((int)e.x, (int)e.y);
                drawArea.GraphicsList[0].MoveHandleTo(p, 5);
                drawArea.MapControl.Refresh();
            }
        }
	}
}
